package top.cardone.data.service.impl;

import org.springframework.transaction.annotation.Transactional;
import top.cardone.data.dao.CrudDao;
import top.cardone.data.service.CrudService;

import java.util.List;
import java.util.Map;

/**
 * Created by yao hai tao on 2015/8/24.
 */
@Transactional(readOnly = true)
public class CrudServiceImpl<Dao extends CrudDao> implements CrudService {
    @lombok.Setter
    protected Dao dao;

    @Override
    @Transactional
    public int delete(Object delete) {
        return this.dao.delete(delete);
    }

    @Override
    @Transactional
    public int deleteAll() {
        return this.dao.deleteAll();
    }

    @Override
    @Transactional
    public int deleteByIds(Object ids) {
        return this.dao.deleteByIds(ids);
    }

    @Override
    @Transactional
    public int[] deleteList(List<Object> deleteList) {
        return this.dao.deleteList(deleteList);
    }

    @Override
    public List<Map<String, Object>> findList(Object findList) {
        return this.dao.findList(findList);
    }

    @Override
    public Map<String, Object> findOne(Object findOne) {
        return this.dao.findOne(findOne);
    }

    @Override
    @Transactional
    public int insert(Object insert) {
        return this.dao.insert(insert);
    }

    @Override
    @Transactional
    public int insertByNotExists(Object insert) {
        return this.dao.insertByNotExists(insert);
    }

    @Override
    @Transactional
    public int[] insertList(List<Object> insertList) {
        return this.dao.insertList(insertList);
    }

    @Override
    @Transactional
    public int[] insertListByNotExists(List<Object> insertList) {
        return this.dao.insertListByNotExists(insertList);
    }

    @Override
    public List<Object> readList(Object readList) {
        return this.dao.readList(readList);
    }

    @Override
    public Object readOne(Object readOne) {
        return this.dao.readOne(readOne);
    }

    @Override
    @Transactional
    public Integer save(Object save) {
        return this.dao.save(save);
    }

    @Override
    @Transactional
    public int update(Object update) {
        return this.dao.update(update);
    }

    @Override
    @Transactional
    public int[] updateList(List<Object> updateList) {
        return this.dao.updateList(updateList);
    }

    @Override
    @Transactional
    public int[][] saveList(List<Object> saveList) {
        return this.dao.saveList(saveList);
    }
}
